<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>javascript</title>
		
	</head>
	<body>
		<p id="demo">Hello world</p>
		<button onclick="myFunction()">diandian</button>
		<script type="text/javascript">
			function myFunction(){
				var x;
				var txt="";
				var person={fname:"Bill",lname:"Gates",age:56}
				for (x in person){
					txt += person[x];
				}
				document.getElementById("demo").innerHTML=txt;
			}
			function convert(degree){
				if (degree=="C"){
					F=document.getElementById("c").value * 9 / 5 + 32;
					document.getElementById("f").value=Math.round(F);
				}
				else{
					C=(document.getElementById("f").value -32) * 5 / 9;
					document.getElementById("c").value=Math.round(C);
				}
			}
		</script>
		<p><b>在输入框中输入一个值</b></p>
		<form>
			<input id="c" name="c" onkeyup="convert('C')" />摄氏度<br>
			<input id="f" name="f" onkeyup="convert('F')" />华氏度
		</form>
	</body>
</html>
